<?php

namespace addons\cjaddress;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Cjaddress extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = [
            [
                'name'    => 'cjaddress',
                'title'   => '用户地址管理',
                'icon'    => 'fa fa-file-text-o',
//                'ismenu' => 1,
//                'weight'  => 1,
                'remark'  => '常用于管理地址',
                'sublist' => [
                    [
                        'name'=>"cjaddress/address",
                        'title'=>'地址管理',
                        'icon'=>'fa fa-table',
                        'sublist'=>[
                            ['name'=>'cjaddress/address/index','title'=>'查看'],
                            ['name'=>'cjaddress/address/add','title'=>'添加'],
                            ['name'=>'cjaddress/address/edit','title'=>'编辑'],
                            ['name'=>'cjaddress/address/del','title'=>'删除'],
                            ['name'=>'cjaddress/address/multi','title'=>'批量更新'],
                        ]
                    ]
                ]
            ]
        ];
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('cjaddress');
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable('cjaddress');
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable('cjaddress');
        return true;
    }

}
